﻿using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class GameTime : MonoBehaviour {


	public float totalGameTime;
	public static float currTime;
	private Text timeText;
	// Use this for initialization
	void Start () {
		currTime = totalGameTime;
		timeText = GetComponent<Text> ();
		timeText.text = "Time: \n" + ((int)currTime).ToString();
	}
	
	// Update is called once per frame
	void Update () {
		currTime -= Time.deltaTime;
		timeText.text = "Time: \n" + ((int)currTime).ToString();
		if (currTime < 0f) {
			Screen.showCursor = true; 
			UIManagerScript.enabledLose = true;
			Application.LoadLevel ("Menu");
		}
	}
}
